<!DOCTYPE html>
<html lang="en">

<head>
    <link href="${ctx}/resources/css/bootstrap.min.css" rel="stylesheet">
    <link href="${ctx}/resources/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx}/resources/css/plugins/dataTables/dataTables.bootstrap.css?v=1.4.0" rel="stylesheet"/>
    <link href="${ctx}/resources/css/animate.min.css" rel="stylesheet">
    <link href="${ctx}/resources/css/style.min.css?v=4.1.1" rel="stylesheet">
    <link href="${ctx}/resources/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctx}/resources/css/plugins/treeTable/css/jquery.treetable.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>菜单列表</h5>
                </div>
                <div class="ibox-content">

                    <div class="row">
                        <div class="col-sm-12">
                            <div class="pull-left">
                                <@shiro.hasPermission name="sys:menu:save">
                                    <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left"
                                            onclick="add()" title="添加"><i class="fa fa-plus"></i> 添加
                                    </button><!-- 增加按钮 -->
                                </@shiro.hasPermission>
                                <@shiro.hasPermission name="sys:menu:edit">
                                    <button class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="left"
                                            onclick="edit()" title="修改"><i class="fa fa-file-text-o"></i> 修改
                                    </button><!-- 编辑按钮 -->
                                </@shiro.hasPermission>
                                <@shiro.hasPermission name="sys:menu:delete">
                                    <button class="btn btn-white btn-sm" onclick="deleteAll()" data-toggle="tooltip"
                                            data-placement="top"><i class="fa fa-trash-o"> 删除</i></button><!-- 删除按钮 -->
                                </@shiro.hasPermission>
                                <button class="btn btn-white btn-sm " data-toggle="tooltip" data-placement="left"
                                        onclick="refresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i> 刷新
                                </button>

                            </div>
                        </div>
                    </div>
                    <table id="treeTable"
                           class="table table-striped table-bordered table-hover table-condensed dataTable">
                        <thead>
                        <tr>
                            <th><input type="checkbox" class="i-checks"></th>
                            <th>名称</th>
                            <th style="width: 13%">链接</th>
                            <th style="text-align:center;">排序</th>
                            <th>可见</th>
                            <th>权限标识</th>
                        <@shiro.hasPermission name="sys:menu:edit">
                            <th>操作</th>
                        </@shiro.hasPermission>
                        </tr>
                        </thead>
                        <tbody>
                        <#list menus as menu>
                            <#if menu.parentId != 0 >
                            <tr data-tt-id="${menu.id}" <#if menu.permission??>data-tt-parent-id="${menu.parentId}"</#if>>
                                <td><input type="checkbox" id="${menu.id}" class="i-checks"></td>
                                <td><a <#if menu.isShow == 1 >controller="true"</#if>>${menu.menuName}</a></td>
                                <td>${menu.menuHref}</td>
                                <td>
                                    <@shiro.hasPermission name="sys:menu:edit">
                                        <input type="hidden" name="ids" value="${menu.id}"/>
                                        <input name="sorts" type="text" value="${menu.menuSort}" class="form-control"
                                               style="width:100px;margin:0;padding:0;text-align:center;">
                                    </@shiro.hasPermission>
                                    <@shiro.lacksPermission name="sys:menu:edit">
                                    ${menu.menuSort}
                                    </@shiro.lacksPermission>
                                </td>
                                <td>
                                    <#if menu.isShow == 1>显示<#else >隐藏</#if>
                                </td>
                                <td>
                                ${menu.permission}
                                </td>
                                <td>
                                    <@shiro.hasPermission name="sys:menu:view">
                                        <a href="#"
                                           onclick="openDialogView('查看菜单', '${ctx}/admin/sys/menu/form?id=${menu.id}')"
                                           class="btn btn-info btn-xs"><i class="fa fa-search-plus"></i> 查看</a>
                                    </@shiro.hasPermission>
                                    <@shiro.hasPermission name="sys:menu:edit">
                                        <a href="#"
                                           onclick="openDialog('修改菜单', '${ctx}/admin/sys/menu/form?id=${menu.id}')"
                                           class="btn btn-success btn-xs"><i class="fa fa-edit"></i> 修改</a>
                                    </@shiro.hasPermission>
                                    <@shiro.hasPermission name="sys:menu:delete">
                                        <a href="${ctx}/admin/sys/menu/delete?id=${menu.id}"
                                           onclick="return confirmx('要删除该菜单及所有子菜单项吗？', this.href)"
                                           class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> 删除</a>
                                    </@shiro.hasPermission>
                                    <@shiro.hasPermission name="sys:menu:save">
                                        <a href="#"
                                           onclick="openDialog('添加下级菜单', '${ctx}/sys/menu/form?parent.id=${menu.id}','800px', '500px')"
                                           class="btn btn-primary btn-xs"><i class="fa fa-plus"></i> 添加下级菜单</a>
                                    </@shiro.hasPermission>
                                </td>
                            </tr>
                            </#if>
                        </#list>
                        </tbody>
                    </table>



                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctx}/resources/js/jquery.min.js"></script>
<script src="${ctx}/resources/js/plugins/pace/pace.min.js"></script>
<script src="${ctx}/resources/js/plugins/treeTable/jquery.treetable.js"></script>
<script src="${ctx}/resources/js/plugins/iCheck/icheck.min.js"></script>
<script src="${ctx}/resources/js/menuList.js?v=221"></script>
<script src="${ctx}/resources/js/dialog.js?v=2017514"></script>
</body>
</html>